import java.util.Scanner;

public class Test {

    public static int countSegments(String s) {
        if(s.length()==0) return 0;
        String ret[]=s.split(" ");
        int count=0;
        for(String x:ret){
            if(x.length()!=0){  //说明这个元素里面不止一个字符
                count++;
            }
        }
        return count;
    }

    public static void main(String[] args) {
        System.out.println(countSegments(", , , ,"));
    }



    public static void main4(String[] args) {
        String str=new String("ab");
        String str1=new String("a")+new String("b");

    }
    public static void main3(String[] args) {
        StringBuilder stringBuilder=new StringBuilder("hello");
        stringBuilder.reverse();
        System.out.println(stringBuilder);

    }


    public static void main2(String[] args) {
        String str="hello";
        str+=" world";
        System.out.println(str);

    }

    public static void main1(String[] args) {
        String str="   abc d e";
        System.out.println(str);
        String str2=str.trim();
        System.out.println(str2);

    }
}
